<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/html">
    //1.定义函数
    function printAll() {
        console.log(10)
    }
//    debugger;
    //2.调用函数
    printAll();

</script>
<script type="text/html">
    //1.函数声明
    function sum() {
        console.log(4+1);

    }

    sum();

    //2.函数声明
    var add = function () {
        console.log(4+1);
    }
    add();
    //3.使用Fuction构造函数
    var add1 = new function () {

    }
</script>
<script type="text/html">
    function isEvent(num) {
     if(num%2 == 0){
         return 'notodd';
     }
     else
     {
         return'odd';
     }

    }

    console.log(isEvent(10));
</script>
<script type="text/html">
    document.onclick = function () {
        alert('点我');
    }
    setInterval(function () {
        alert("fdfdfds");
    },1000)//定时器
</script>
<script type="text/html">
    //回调函数 自己调用自己

    function fn(num1,num2,func) {
        return func(num1,num2);
    }

// add 加减乘除
    function add (a,b) {
        return a+b;
    }
    function sub (a,b) {
        return a-b;
    }
    function mul (a,b) {
        return a*b;
    }   function divide (a,b) {
        return a/b;
    }

    //回调

    console.log(fn(1, 2, add));

    //fibonacci
    function f1(n) {
        if (n === 1 || n ===2) return 1 ;
        return f1(n-1) + f1(n-2);


    }

    //n个数的累加
    function getSum(n) {
        if (n === 1) return 1;
        return n + getSum(n - 1);

    }

</script>
// emcscript  bom dom---javascript

</body>
</html>